﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace WPF人员管理
{
    class MyViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private ICommand _command1;
        public ICommand Command1
        {
            get
            {
                return _command1 ?? (_command1 = new RelayCommand(OnCommand1Execute));
            }
        }

        private void OnCommand1Execute()
        {
            // 执行命令的逻辑代码
            // 例如: ExecuteCommand1();
            MessageBox.Show("hello");
        }

        // 其他的属性...
    }

    internal class RelayCommand : ICommand
    {
        private Action onCommand1Execute;

        public RelayCommand(Action onCommand1Execute)
        {
            this.onCommand1Execute = onCommand1Execute;
        }

        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
           
            return true;
        }

        public void Execute(object parameter)
        {
            onCommand1Execute();
        }
    }
}
